//
//  TYPlayingViewController.m
//  黑马音乐盒
//
//  Created by 翟天宇 on 15/11/27.
//  Copyright © 2015年 翟天宇. All rights reserved.
//

#import "TYPlayingViewController.h"
#import "UIView+AdjustFrame.h"


@interface TYPlayingViewController ()
- (IBAction)exit;

@end

@implementation TYPlayingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
-(void)show {
//1.拿到window
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    
    //设置窗口不与用户交互
    window.userInteractionEnabled = NO;
    
    //2.设置view的frame
    self.view.frame = window.bounds;
    
    //3.将自身的view添加到window上
    [window addSubview:self.view];
    
    //4.给self.view添加动画
    self.view.y = self.view.height;
    
    [UIView animateWithDuration:1.0 animations:^{
        self.view.y = 0;
    }completion:^(BOOL finished) {
        window.userInteractionEnabled = YES;
    }
     ];
    
}




- (IBAction)exit {
    
    //1.拿到window
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    window.userInteractionEnabled = NO;
    
    //2.执行动画退出
    [UIView animateWithDuration:1.0 animations:^{
        self.view.y = self.view.height;
    }completion:^(BOOL finished) {
        window.userInteractionEnabled = YES;
    }
    
    
    
     ];
    
}
@end
